﻿using FarmSmartSleep.Common.Dtos;
using FarmSmartSleep.Organ.API.Application.Commands.SheepFarmCommands;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace FarmSmartSleep.Organ.API.Controllers
{
    /// <summary>
    /// 羊场信息控制器--API
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]

    public class SheepFarmController : ControllerBase
    {
        public readonly IMediator mediator;

        public SheepFarmController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 羊场新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepFarmAdd(SheepFarmCreateCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 羊场列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepFarmList(SheepFarmSelectCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 羊场反填
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepFarmFill(SheepFarmFillCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
